CREATE FUNCTION func_getDanhSachHangHoa
(	
)
RETURNS @temp TABLE 
(
 TenHangHoa nvarchar(50),
 SoLuongTonKho nvarchar(300)
)
AS
Begin
 	Declare @TenHangHoa nvarchar(50)
	Declare @SoLuongTonKho nvarchar(300)
	Declare @curDanhSachHangHoa Cursor
	SET @curDanhSachHangHoa = CURSOR FOR
		SELECT * from DanhMucTaiKhoan
		     
	OPEN @curDanhMucTaiKhoan
	FETCH NEXT FROM @curDanhMucTaiKhoan INTO @STT, @TenLoaiTaiKhoan, @Quyen
	WHILE @@FETCH_STATUS = 0
	BEGIN
		Insert @temp values
			(
				@STT,
				@TenLoaiTaiKhoan,
				@Quyen
			)
		FETCH NEXT FROM @curDanhMucTaiKhoan INTO @STT, @TenLoaiTaiKhoan, @Quyen
	END
	
	RETURN
End
